<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>职位</title>
    <script src="https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/3.5.1/jquery.min.js"></script>
    <script>

        function getQueryVariable(variable) {
            var query = window.location.search.substring(1);
            var vars = query.split("&");
            for (var i=0;i<vars.length;i++) {
                var pair = vars[i].split("=");
                if(pair[0] == variable){return pair[1];}
            }
            return(false);
        }

        function log(userId,jobCode,action){
            $.ajax({
                type: "POST",
                url: "http://www.log.com/log",
                dataType: "text",
                contentType: 'text/plain',  //application/json;charset=utf-8
                data:JSON.stringify({ user_id:userId, act_time:  new Date().getTime(), action:action, job_code:jobCode }),
                success: function(data){
                },
                error:function(data){
                }
            });
        }

        function operation(jobCode,action){
            var userId = getQueryVariable("userId");
            log(userId,jobCode,action)
            $.ajax({
                type: "POST",
                url: "http://www.biz.com/lagou/operation",
                dataType: "text",
                contentType: 'application/json;charset=utf-8',
                success: function(data){
                    alert(data);
                },
                error:function(data){
                    alert("error");
                }
            });
        }

    </script>
</head>
<body>
    <table border="1">
        <thead>
            <tr>
                <td>企业</td>
                <td>职位</td>
                <td>操作</td>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>阿里</td>
                <td>JAVA</td>
                <td>
                    <button onclick="operation('AL', 'click')">点击</button>
                    <button onclick="operation('AL', 'job_collect')">收藏</button>
                    <button onclick="operation('AL', 'cv_send')">投简历</button>
                    <button onclick="operation('AL', 'cv_upload')">上传简历</button>
                </td>
            </tr>
            <tr>
                <td>腾讯</td>
                <td>JAVA</td>
                <td>
                    <button onclick="operation('TX', 'click')">点击</button>
                    <button onclick="operation('TX', 'job_collect')">收藏</button>
                    <button onclick="operation('TX', 'cv_send')">投简历</button>
                    <button onclick="operation('TX', 'cv_upload')">上传简历</button>
                </td>
            </tr>
        </tbody>
    </table>
</body>
</html>